package com.yykj.order.center.server.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.yykj.order.center.server.util.StringUtil;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Index;
import javax.persistence.Table;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Builder
@Table(
        indexes = {
                @Index(columnList = "patientName"),
                @Index(columnList = "patientMobile"),
                @Index(columnList = "patientMedicalNo"),
                @Index(columnList = "orderNo"),
                @Index(columnList = "applyDoctorId"),
                @Index(columnList = "applyDoctorHospitalId"),
                @Index(columnList = "status"),
        }
)
/**
 * 专家会诊订单
 */
public class Consultation {

    @Id
    @Column(length = 32)
    @TableId(type = IdType.INPUT)
    public String id;

    @Column(columnDefinition = "varchar(64) DEFAULT '' COMMENT '患者姓名'", nullable = true)
    public String patientName;

    @Column(columnDefinition = "int(1) DEFAULT 0 COMMENT '患者性别,0:不明,1:男,2:女'", nullable = true)
    public int patientGender;

    @Column(columnDefinition = "int(10) DEFAULT 0 COMMENT '患者年龄'", nullable = true)
    public String patientAge;

    @Column(columnDefinition = "varchar(64) DEFAULT '' COMMENT '患者手机'", nullable = true)
    public String patientMobile;

    @Column(columnDefinition = "varchar(64) DEFAULT '' COMMENT '患者就诊卡号/病历号'", nullable = true)
    public String patientMedicalNo;

    @Column(columnDefinition = "varchar(64) DEFAULT '' COMMENT '患者身份证'", nullable = true)
    public String patientIdCard;

    @Column(columnDefinition = "varchar(64) DEFAULT '' COMMENT '唯一订单编号'", nullable = true)
    public String orderNo;

    @Column(columnDefinition = "varchar(64) DEFAULT '' COMMENT '申请医生Id'", nullable = true)
    public String applyDoctorId;

    @Column(columnDefinition = "varchar(64) DEFAULT '' COMMENT '申请医生名字'", nullable = true)
    public String applyDoctorName;

    @Column(columnDefinition = "varchar(64) DEFAULT '' COMMENT '申请医生ImId'", nullable = true)
    public String applyDoctorImId;

    @Column(columnDefinition = "int(10)DEFAULT 0 COMMENT '申请医生所属医院Id'", nullable = true)
    public int applyDoctorHospitalId;

    @Column(columnDefinition = "varchar(64) DEFAULT '' COMMENT '申请医生所属医院名字'", nullable = true)
    public String applyDoctorHospitalName;

    @Column(columnDefinition = "int(10) DEFAULT 0 COMMENT '申请医生所属部门Id'", nullable = true)
    public int applyDoctorDepartmentId;

    @Column(columnDefinition = "varchar(64) DEFAULT '' COMMENT '申请医生所属部门名字'", nullable = true)
    public String applyDoctorDepartmentName;

    @Column(columnDefinition = "varchar(64) DEFAULT '' COMMENT '联系电话'", nullable = true)
    private String mobile;

    @Column(columnDefinition = "varchar(200) DEFAULT '' COMMENT '职称'", nullable = true)
    private String officer;

    @Column(columnDefinition = "varchar(200) DEFAULT '' COMMENT '医生头像图片地址'", nullable = true)
    public String headImg;

    @Column(columnDefinition = "varchar(200) DEFAULT '' COMMENT '医生签名图片地址'", nullable = true)
    public String sign;

    @Column(columnDefinition = "varchar(64) DEFAULT '' COMMENT '本次会诊群聊Id'", nullable = true)
    public String groupImId;

    @Column(columnDefinition = "int(10) DEFAULT 0 COMMENT '会诊状态,-1:超时关闭,0:订单创建成功,1:无需审核直接进入问诊,2:审核中,3:审核通过可进入问诊," +
            "4:审核失败,5:申请医师自己退单审核中, 6:申请医师自己退单审核通过, 7:申请医师自己退单审核失败, 8:已完成'", nullable = true)
    public int status;

    @Column(columnDefinition = "varchar(2000) DEFAULT '' COMMENT '就诊结论'", nullable = true)
    public String conclusion;

    @Column(columnDefinition = "varchar(64) DEFAULT '' COMMENT '会诊类型Id'", nullable = true)
    public String typeId;

    @Column(columnDefinition = "varchar(64) DEFAULT '' COMMENT '会诊类型名字'", nullable = true)
    public String typeName;

    @Column(columnDefinition = "varchar(200) DEFAULT '' COMMENT '若需要审核,审核失败原因'", nullable = true)
    public String remark;

    @Column(columnDefinition = "int(10) DEFAULT '0' COMMENT '审核时间'", nullable = true)
    public int reviewTime;

    @Column(columnDefinition = "varchar(200) DEFAULT '' COMMENT '退单原因'", nullable = true)
    public String chargebackRemark;

    @Column(columnDefinition = "int(10) DEFAULT '0' COMMENT '退单时间'", nullable = true)
    public int chargebackTime;

    @Column(columnDefinition = "varchar(200) DEFAULT '' COMMENT '退单审核失败原因'", nullable = true)
    public String chargebackReviewRemark;

    @Column(columnDefinition = "int(10) DEFAULT '0' COMMENT '退单审核时间'", nullable = true)
    public int chargebackReviewTime;

    @Column(columnDefinition = "int(10) DEFAULT '0' COMMENT '会诊结束时间'", nullable = true)
    public int finishTime;

    @Column(columnDefinition = "varchar(200) DEFAULT '' COMMENT '群聊头像地址'", nullable = true)
    public String faceUrl;

    @Column(columnDefinition = "int(10) DEFAULT '0' COMMENT '添加时间'", nullable = true)
    public int addtime = StringUtil.getCurrentTime();
}
